# -*- coding: utf-8 -*-

from odoo import models, fields


class WechatModuleConfigSettings(models.TransientModel):
    _name = 'wechat.module_config_settings'
    _inherit = 'res.config.settings'

    secret_key = fields.Char(config_parameter='wechat.secret_key', string='key')
    session_expiration = fields.Integer(config_parameter='wechat.session_expiration', string='token过期时间')

    redis_host = fields.Char(config_parameter='wechat.redis_host', string='redis地址')
    redis_port = fields.Integer(config_parameter='wechat.redis_port', string='redis端口')
    redis_db = fields.Integer(config_parameter='wechat.redis_db', string='redis数据库')
    redis_password = fields.Char(config_parameter='wechat.redis_password', string='redis密码')

    user_expiration = fields.Integer(config_parameter='wechat.user_expiration', string='用户缓存时间')

    formid_expiration = fields.Integer(config_parameter='wechat.formid_expiration', string='用户formid缓存时间')

    access_token_default_expiration = fields.Integer(
        config_parameter='wechat.access_token_default_expiration',
        string='access token 默认过期时间',
    )
    access_token_expiration_tolerance = fields.Integer(
        config_parameter='wechat.access_token_expiration_tolerance',
        string='access token 过期提前时间'
    )

    oauth_redirect_url = fields.Char(config_parameter='wechat.oauth_redirect_url', string='OAuth URL')
    post_oauth_redirect_url_default = fields.Char(config_parameter='wechat.post_oauth_redirect_url_default', string='认证成功默认跳转地址')
